package sunny.com.girlname;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.beans.Transient;

@Service //不加这个，引用会出现问题
public class GirlService {

    @Autowired
    private GrilRepository grilRepository;

    //不加这个，有一个报错，但是A是添加成功的
    @Transactional
    public  void insertTwo() {
        Girl girlA = new Girl();
        girlA.setCupSize("A");
        girlA.setAge(15);
        grilRepository.save(girlA);

        Girl girlB = new Girl();
        girlB.setCupSize("BB");
        girlB.setAge(16);
        grilRepository.save(girlB);
    }
}
